<?php
//PDO的修改方法
function save($arr){
	//$link=mysqli_connect("127.0.0.1", "root", "root", "news");
	$pdo = new PDO("mysql:host=127.0.0.1;dbname=news","root","keyan");
	//$link->query("set names utf8");
	$pdo->query("set names utf8");
	foreach($arr as $k=>$v){
		$str .= $k."="."?".",";
	}
	$str = trim($str,",");
	$sql = "update newstypes set $str where typeId=13";
	echo $sql;
	$pdos=$pdo->prepare($sql);
	$re=$pdos->execute(array_values($arr));//执行
	if($re){
		echo "<hr>修改成功";
		return true;
	}else{
		echo "<hr>修改失败";
		return false;
	}
}
$arr= array("typeName"=>"'or 6=6#","articleNums"=>"789");
//save($arr);
var_dump(true);